package com.example.HaiDLaobackend.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.HaiDLaobackend.entity.PostEntity;
import com.example.HaiDLaobackend.mapper.PostMapper;
import com.example.HaiDLaobackend.service.PostService;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

@Service
public class PostServiceImpl extends ServiceImpl<PostMapper, PostEntity> implements PostService {
	
	// 违禁词列表（可根据需要扩展）
	private static final List<String> FORBIDDEN_WORDS = Arrays.asList(
		"违禁词1", "违禁词2", "敏感词", "禁止", "违规"
	);
	
	@Override
	public boolean containsForbiddenWords(String text) {
		if (text == null || text.isEmpty()) {
			return false;
		}
		String lowerText = text.toLowerCase();
		return FORBIDDEN_WORDS.stream().anyMatch(word -> 
			lowerText.contains(word.toLowerCase())
		);
	}
}

